import math

def circle(data:dict):
    """
    计算圆形，输入一个字典，返回一个字典
    :param data:字典，直径diameter，面积area，圆周长circumference
    :return res:字典
    """
    if "diameter" in data:
        diameter = data["diameter"]
        radius = diameter / 2
    elif "area" in data:
        area = data["area"]
        radius = math.sqrt(area / math.pi)
    elif "circumference" in data:
        circumference = data["circumference"]
        radius = circumference / math.pi / 2
    else:
        radius = 0
    return {
        "diameter" : 2 * radius,
        "area" : math.pi * radius * radius,
        "circumference" : 2 * math.pi * radius
    }


def test():
    """
    测试函数
    :return:
    """
    print(circle({"diameter": 2}))
    print(circle({"area":3.1415926}))

test()